import React, { Component } from 'react'
import { View, Text, TouchableOpacity } from 'react-native'
import { Actions } from 'react-native-router-flux'
import commonStyle from '../../libs/commonStyle'
import Iconfont from '../../components/iconfont'

export default class Error extends Component {
	componentDidMount() {
		// alert(JSON.stringify(Actions.state.routes[0].routes[2].key))
		// let list = Actions.state.routes || []
		// let popNum = 1
		// list.forEach((item, index) => {
		//   let routes = item.routes
		//   routes.
		//   if (item.)
		// })
	}
	onHandle() {
		// Actions.login()
		Actions.pop()
	}
	render() {
		let params = this.props.navigation.state.params || {}

		return (
			<View
				style={[
					commonStyle.flexItem,
					commonStyle.flexColumn,
					commonStyle.flexCenter
				]}
			>
				<TouchableOpacity
					style={[commonStyle.flexCenter]}
					onPress={this.onHandle.bind(this)}
				>
					<View
						style={[
							commonStyle.border,
							commonStyle.w150,
							commonStyle.h150,
							commonStyle.circle100,
							commonStyle.flexCenter,
							commonStyle.activeBorderColor,
							commonStyle.mb50
						]}
					>
						<Iconfont
							name="close_line"
							style={[
								commonStyle.f100,
								commonStyle.fontBold,
								commonStyle.activeColor
							]}
						/>
					</View>
					<Text
						style={[commonStyle.f36, commonStyle.colorBlackLight]}
					>
						{/* {params.err || '发生错误，请稍后重试'} */}
						{'发生错误，请稍后重试'}
					</Text>
				</TouchableOpacity>
			</View>
		)
	}
}
